//Calculate heat gain using time series
function get_q_xts(q,xts){
var qh =  new Array();
for (var j=1; j<=24; j++){
    qh[j] = 0;
    for (k=0; k<=23; k++){

        if (j>k){
            qh[j] = qh[j] + xts[k] * q[j-k]/100;
        }
        if (j<=k){
            qh[j] = qh[j] + xts[k] * q[j-k+24]/100;
        }
        }   
        }
        return(qh);
        }